<template>
  <div>
    <div class="merchant">
      <van-sticky :offset-top="1">
        <div id="header" class="header aui-bg-red aui-padded-10"></div>
      </van-sticky>
      <div id="main">
          <div style="position: fixed;left: 0;top: 20px;z-index: 999">
            <div id="close" class="close aui-padded-15">
                <div class="close_cont aui-bg-red aui-text-center" @click="back">
                    <i class="iconfont icon-fanhui aui-text-f aui-ftn18"></i>
                </div>
            </div>
          </div>
          <div class="top">
              <img src="../../assets/merchant/sjyq_chahua1.png" alt="">
              <img src="../../assets/merchant/sjyq_chahua2.png" alt="">
              <div class="link aui-bg-f aui-margin-10">
                  <input type="text" name="link" v-model="link" class="aui-border-0 aui-text-center aui-ftn13 aui-font-weight">
                  <div class="aui-text-center aui-margin-t-15">
                      <div class="aui-btn aui-ftn13 aui-text-f aui-font-weight" id="link" data-clipboard-action="copy" :data-clipboard-text="link"  @click="fnCopyText('#link')">复制商家平台链接</div>
                  </div>
              </div>
          </div>
          <div class="bt aui-bg-f aui-margin-10">
              <img src="../../assets/merchant/img1.png" alt="">
              <img src="../../assets/merchant/img2.png" alt="">
              <img src="../../assets/merchant/img3.png" alt="">
              <img src="../../assets/merchant/img4.png" alt="">
          </div>
      </div>
  </div>
  </div>
</template>
<script>
  import Index from '../../service/index.js'
  export default {
    data () {
      return {
        link: ''
      }
    },
    mounted() {
      this.init()
    },
    methods: {
      init: function() {
        Index.fnGetMerchantData().then(ret => {
          if (ret && ret.status) {
              this.link = ret.data;
          }
        })
      },
      fnCopyText: function(el) {
        let vm = this;
        let clipboard = new this.clipboard(el);
        clipboard.on('success', function () {
          vm.utils.fnMsg("复制成功")
        });
        clipboard.on('error', function () {
          vm.utils.fnMsg("复制失败")
        });
      }
    }
  }
</script>

<style scoped>
  div.close {
    position: fixed;
    left: 0;
    z-index: 999;
}
div.close div.close_cont {
    width: 36px;
    height: 36px;
    line-height: 36px;
    border-radius: 50%;
}
img {
    width: 100%;
    vertical-align: middle;
}
div.link {
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 4px #d6eaf3;
    -webkit-transform: translateY(-48px);
       -moz-transform: translateY(-48px);
        -ms-transform: translateY(-48px);
         -o-transform: translateY(-48px);
            transform: translateY(-48px);
}
div.link input {
    background-color: rgba(54, 153, 255, .1);
    border-radius: 5px;
    height: 34px;
    line-height: 34px;
    margin: auto;
    border: 0;
    width: 75%;
    display: block;
    color: #3699FF;
}
div.link div.aui-btn {
    width: 50%;
    height: 40px;
    line-height: 40px;
    background-color: #3699FF;
}
div.merchant div.bt {
    padding: 40px 30px;
    border-radius: 5px;
    -webkit-transform: translateY(-48px);
       -moz-transform: translateY(-48px);
        -ms-transform: translateY(-48px);
         -o-transform: translateY(-48px);
            transform: translateY(-48px);
}
div.merchant div.bt img {
    margin-top: 40px;
}
</style>
